package com.newdjk.newdoctor.utils;



import android.text.TextUtils;

import com.newdjk.newdoctor.entity.AppEntity;
import com.newdjk.newdoctor.net.BaseComPleteObserver;
import com.newdjk.newdoctor.net.NetServices;
import com.newdjk.okhttp.entity.BaseEntity;
import com.newdjk.okhttp.entity.OrganizationInfoEntity;

import java.util.HashMap;
import java.util.Map;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public enum HomeUtils {
    INSTANCE;

    public void checkVersion(final UpdateListener listener) {
        NetServices.Factory.getService().GetAppManage().subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseComPleteObserver<AppEntity >() {
                    @Override
                    protected void onFailure(Throwable e, String erroressage, boolean isNetWorkError) throws Exception {
                        super.onFailure(e, erroressage, isNetWorkError);
                        listener.failed(1, erroressage);
                    }

                    @Override
                    protected void onSuccees(BaseEntity<AppEntity > t) throws Exception {

                        listener.success(t.getData());
                    }
                });

    }

    public interface UpdateListener {
        void success(AppEntity entity);

        void failed(int statusCode, String errorMsg);
    }
}
